/* -------- 文件写入流 -------- */

let fs = require('fs');
let write = fs.createWriteStream('./data/text2.txt');
let data = '这是要写入的数据';

write.write(data, 'UTF8');
write.end();

write.on('finish', function () {
	console.log('数据写入完成!');
})

write.on('error', function () {
	console.log('出错信息: ', err.stack);
})

console.log('文件写入流.js执行完毕');